﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DayStatisticControl.ascx.cs" Inherits="Controls_DayStatisticControl" %>

Отчет за: <asp:Label ID="lblDate" runat="server" />

<asp:ListView ID="lvDays" runat="server" DataKeyNames="Id" 
    onitemdatabound="lvDays_ItemDataBound">
    
    <LayoutTemplate>
        <table class="list">
            <tr id="itemPlaceHolder" runat="server" />
        </table>
    </LayoutTemplate>
    
    <ItemTemplate>
        <tr>
            <td class="order_header">
                <b><asp:Label ID="lblName" runat="server" /></b>
                
                <asp:ListView ID="lvItems" runat="server" DataKeyNames="Id"
                    OnItemCanceling="lvItems_Canceling"
                    OnItemEditing="lvItems_Editing"
                    OnItemDeleting="lvItems_Deleting"
                    OnItemUpdating="lvItems_Updating">
                    
                    <LayoutTemplate>
                        <table class="order_tbl">
                            <tr id="itemPlaceHolder" runat="server" />
                        </table>
                    </LayoutTemplate>

                    <ItemTemplate>
                        <tr class="listRow">
                            <td style="width: 70%;">
                                <%# Eval("Product.Name") %>
                            </td>
                            <td style="width: 20%;">
                                <%# Eval("Amount", "{0:N2}") %>
                            </td>
                            <td style="width: 10%;">
                                <asp:ImageButton ID="btnEdit" Width="16px" Height="16px" runat="server" ValidationGroup="Item" ToolTip="Редактировать" CommandName="Edit" ImageUrl="~/Images/icons/edit.png" />&nbsp;
                                <asp:ImageButton ID="btnDelete" Width="16px" Height="16px" runat="server" ValidationGroup="Item" OnClientClick="return confirm('Вы уверены, что хотите это удалить???');" ToolTip="Удалить" CommandName="Delete" ImageUrl="~/Images/icons/delete.png" />
                            </td>
                        </tr>
                    </ItemTemplate>

                    <EditItemTemplate>
                        <tr class="listRow">
                            <td style="width: 70%;">
                                <%# Eval("Product.Name") %>
                            </td>
                            <td style="width: 20%;">
                                <asp:TextBox ID="txtAmount" runat="server" Width="50px" ValidationGroup="Item" Text='<%# Eval("Amount", "{0:N2}") %>' />
                                <asp:RequiredFieldValidator ID="eAmountReq" runat="server" ControlToValidate="txtAmount" ErrorMessage="*" ForeColor="Red" 
                                    ToolTip="Значение не должно быть пустым!" ValidationGroup="Item" /> 
                                <asp:RegularExpressionValidator ID="eAmountReg" runat="server" ControlToValidate="txtAmount" ErrorMessage="*" ForeColor="Red" 
                                    ToolTip="Не корректный формат!" ValidationExpression="[0-9]*,?[0-9]*" ValidationGroup="Item" />
                            </td>
                            <td style="width: 10%;">
                                <asp:ImageButton ID="btnCancel" Width="16px" Height="16px" runat="server" ToolTip="Отменить" ValidationGroup="Item" CommandName="Cancel" ImageUrl="~/Images/icons/cancel.png" />&nbsp;
                                <asp:ImageButton ID="btnApply" Width="16px" Height="16px" runat="server" ToolTip="Применить" ValidationGroup="Item" CommandName="Update" ImageUrl="~/Images/icons/apply.png" />
                            </td>
                        </tr>
                    </EditItemTemplate>

                </asp:ListView>
            </td>
        </tr>
    </ItemTemplate>

    <EmptyDataTemplate>
        Сегодня затрат не было!
    </EmptyDataTemplate>

</asp:ListView>

<div class="sum">
    Общая сумма за день: <asp:Label ID="lblSum" runat="server" />
</div>